#!/usr/bin/env python3.2
# -*- coding: utf-8 -*-

# e.g. use script this way to create macro files:
# for i in scintillators/{BaF,FastBaF,LaBr,LYSO,NaI}*_alu.mac; do ./createDrawMacros.py $i > scintillators/draw_${${i##scintillators/}%%_alu.mac}.mac; done

import sys
import re

print("/control/execute", sys.argv[1])

colors = {
    "FastBaF": (75,92,215),
    "BaF": (60,160,208),
    "LaBr": (255,166,64),
    "LYSO": (230,252,63),
    "NaI": (188,56,211)
    }

for (k,v) in colors.items():
    colors[k] = (v[0]/255., v[1]/255., v[2]/255.)

name = "BaF"
if "/BaF_" in sys.argv[1]:
    name = "BaF"
if "/FastBaF_" in sys.argv[1]:
    name = "FastBaF"
if "/LaBr_" in sys.argv[1]:
    name = "LaBr"
if "/LYSO_" in sys.argv[1]:
    name = "LYSO"
if "/NaI_" in sys.argv[1]:
    name = "NaI"

print("/vis/geometry/set/colour lScintillator -1", ' '.join(map(str, colors[name])), "0.4")